package com.wqtz.chechai.view.activities;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.makeramen.roundedimageview.RoundedTransformationBuilder;
import com.orhanobut.logger.Logger;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Transformation;
import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.presenter.BasePresent;
import com.wqtz.chechai.widget.GestureView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/19 15:30
 */

public class SignUserGestureActivity extends BaseActivity implements GestureView.GestureCallBack {
	@BindView(R.id.gesture1)
	GestureView gestureView;
	@BindView(R.id.iv_user_head)
	ImageView mIvUserHead;
	@BindView(R.id.tv_user_name)
	TextView mTvUserName;
	@BindView(R.id.tv_unlock_forget)
	TextView mTvUnlockForget;
	private ComponentName lastactivityname;//最后添加的activity

	@Override
	public void init() {
		ButterKnife.bind(this);
		gestureView.setGestureCallBack(this);
		Transformation transformation = new RoundedTransformationBuilder()
				.borderWidthDp(0)
				.cornerRadiusDp(30)
				.oval(true)
				.build();

		Picasso.with(this)
				.load(R.drawable.userhead)
				.fit()
				.transform(transformation)
				.into(mIvUserHead);
	}

	@Override
	public void loadData() {

	}

	@Override
	public int setContentViews() {
		return R.layout.activity_signuser;
	}

	@Override
	public BasePresent createPresenter() {
		return null;
	}


	@Override
	public void gestureVerifySuccessListener(int stateFlag, List<GestureView.GestureBean> data, String message, boolean success) {
		if (success) {
			lastactivityname = activitys.get(activitys.size()-1).getComponentName();
			Logger.e(activitys.size()+"");
			Intent intent = new Intent();
			intent.setComponent(lastactivityname);
			startActivity(intent);
			this.finish();
		}
	}


	@OnClick(R.id.tv_unlock_forget)
	public void onClick() {
	}
}
